package com.lifeng.mymq.consumer;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class SimpleConsumer {
	@Test
	public void test(){
		ApplicationContext ac= new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
		/*RabbitTemplate rabbitTemplate = (RabbitTemplate) ac.getBean("rabbitTemplate");
		String queue = "myQueue";
		String str = (String)rabbitTemplate.receiveAndConvert(queue);
		System.out.println("receive:"+str);*/
		//让spring一直运行从而运行监听器接受消息
		while(true){
			try {
				Thread.currentThread().sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
